import * as fabric from 'fabric'

const canvasEl = document.getElementById("myCanvas2")


const canvas = new fabric.Canvas(canvasEl);


var circle = new fabric.Circle({
  radius: 100,
  fill: '#eef',
  scaleY: 0.5,
  originX: 'center',
  originY: 'center'
});

var text = new fabric.Text('hello world', {
  fontSize: 30,
  originX: 'center',
  originY: 'center'
});

var group = new fabric.Group([ circle, text ], {
  left: 150,
  top: 150,
  angle: -10
});


console.log(group)

// 修改circle - 填充色
group.item(0).set('fill', 'red');
group.item(1).set({
  text: 'trololo', // 文本内容
  fill: 'white'  //  文本颜色
});


canvas.add(group);
